﻿<UserControl x:Class="JenkinsController.View.Controls.JobStatusControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="Root">
    <Ellipse Width="16" Height="16"
             Fill="{Binding Status, ElementName=Root, Converter={StaticResource JenkinsJobStatusToBrushConverter}}"
             ToolTip="{Binding Status.State}">

        <Ellipse.Effect>
            <DropShadowEffect BlurRadius="2" ShadowDepth="0" />
        </Ellipse.Effect>

        <Ellipse.Style>
            <Style TargetType="Ellipse">
                <Style.Triggers>

                    <DataTrigger Binding="{Binding Status.IsRunning}"
                                 Value="True">
                        <DataTrigger.EnterActions>
                            <BeginStoryboard Name="RunningAnimation">
                                <Storyboard RepeatBehavior="Forever"
                                            AutoReverse="True">
                                    <DoubleAnimation
                                        Storyboard.TargetProperty="Opacity"
                                        To="0" />
                                </Storyboard>
                            </BeginStoryboard>
                        </DataTrigger.EnterActions>
                        <DataTrigger.ExitActions>
                            <StopStoryboard
                                BeginStoryboardName="RunningAnimation" />
                        </DataTrigger.ExitActions>
                    </DataTrigger>

                </Style.Triggers>
            </Style>
        </Ellipse.Style>
    </Ellipse>
</UserControl>